<script>
	jQuery(function() {
		jQuery( "#filter_published_up" ).datepicker({ dateFormat: 'yy-mm-dd' });
                jQuery( "#filter_published_down" ).datepicker({ dateFormat: 'yy-mm-dd' });
	});
</script>

<div id="search-box">

<%= form_tag({:controller => 'articles', :action => 'index'}, :method => 'GET') do %>
Text: <input type="text" name="filter[text]" id="filter_text" value="<%= @filter[:text] if !@filter.nil? %>">
Author:
<select name="filter[user_id]" id="filter_user_id">
	<option value="">- Choose Author -</option>
	<% @users.each do |user|
		@selected = ''
		if !@filter.nil?
			@selected = user.id.to_s == @filter[:user_id] ? 'selected=selected' : ''
		end
	%>
		<option value="<%= user.id.to_s %>" <%= @selected %> ><%= user.username %></option>
	<% end %>
</select>
Published up: <input type="text" id="filter_published_up" name="filter[published_up]" value="<%= @filter[:published_up] if !@filter.nil? %>" />
Published down: <input type="text" id="filter_published_down"  name="filter[published_down]" value="<%= @filter[:published_down] if !@filter.nil? %>" />
Status:
<select name="filter[article_status_id]" id="filter_article_status_id">
	<option value="">- Status -</option>
	<% @article_statuses.each do |article_status|
		@selected = ''
		if !@filter.nil?
			@selected = article_status.id.to_s == @filter[:article_status_id] ? 'selected=selected' : ''
		end
	%>
		<option value="<%= article_status.id.to_s %>" <%= @selected %> ><%= article_status.title %></option>
	<% end %>
</select>
<input type="submit" title="Search" value="Search" class="button grey" style="height:auto" />

<% end %>

</div>